﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using X23.Application.RoleManagement.Dto;
using X23.Application.UserManagement.Dto;
using X23.EFCore.Service;
using X23.Model.Role;

namespace X23.Application.RoleManagement
{
    public interface IRoleManagementService : ICRUDService<RoleDto, Role>
    {
        /// <summary>
        /// 获取按钮权限
        /// </summary>
        /// <param name="url">菜单路径</param>
        /// <param name="userId">用户id</param>
        /// <returns></returns>
        Task<ButtonPermissionDto> GetButtonPermissionWithCache(string url, int userId);
        /// <summary>
        /// 获取角色树
        /// </summary>
        /// <param name="roleId">角色id</param>
        /// <returns></returns>
        Task<RoleMenuTreeDto> GetRoleMenuTreeDto(int roleId);

        /// <summary>
        /// 添加修改角色树
        /// </summary>
        /// <param name="roleMenuTreeDto">角色树</param>
        /// <returns></returns>
        Task AddOrUpdateRoleMenuTreeDto(RoleMenuTreeDto roleMenuTreeDto);

        /// <summary>
        /// 获取用户下的角色
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <returns></returns>
        Task<List<RoleDto>> GetRoleListByUserId(int userId);
        /// <summary>
        /// 获取角色下的用户
        /// </summary>
        /// <param name="roleId">角色Id</param>
        /// <returns></returns>
        Task<List<UserDto>> GetUserListByRoleId(int roleId);


        /// <summary>
        /// 获取用户权限
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <returns></returns>
        Task<List<UserMenuButtonDto>> GetUserPermissionWithCache(int userId);
    }
}
